package Week9;

import java.util.Scanner;

public class Main {
	public static void main(String[] arge){
		Object[] arr=new Object[5];
		int y=1;
		Scanner in=new Scanner(System.in);
		while(y==1){
			String str=in.next();
			if(str.equals("arr")){
				int a=in.nextInt();
				try{			
					Object b=arr[a];
				}catch(ArrayIndexOutOfBoundsException e){
					System.out.println(e);
				}	
			}	
			
			else if(str.equals("null")){
				try{ 
					throw new NullPointerException();					
				}catch(NullPointerException e){
					System.out.println(e);
				}
			}
			
			else if(str.equals("cast")){
				try{
					Object brr=new String();
					Object b=new Integer(0);
					b=(Integer)brr;					
				}catch(ClassCastException e){
						System.out.println(e);
					}
			}
			
			else if(str.equals("num")){
					try{
						String x=in.next();
						int a = Integer.parseInt(x);
						}catch(NumberFormatException e){
							System.out.println(e);
						}
				}
			else y=0;	
		}
	}
}
